﻿layui.define(['jquery'], function (exports) {
    var $ = layui.jquery;
    var obj = {
        //验证账号密码，如果不正确清空用户信息并跳转到登录页面。       
        userLogin: function (user_account, user_password) {
            $.ajax({
                type: "post",
                url: "/Ashx/admin.ashx",
                data: { functionname: "jhy_user_login", user_account: user_account, user_password: user_password },
                dataType: 'json',
                success: function (msg) {
                    if (msg.error == '0') {
                        layui.data("jhy", null);
                        window.location.href = "/admin/login.html";
                    }
                }
            });
        }, site: function () {
            $.ajax({
                type: "post",
                url: "/Ashx/admin.ashx",
                data: { functionname: "jhy_site_query"},
                dataType: 'json',
                success: function (msg) {                 

                    $(".logo-img").addClass(msg["0"].site_logoicon);
                    $(".logo-text").text(msg["0"].site_logotext);
                    if ($(".item-title").find("span") != undefined) {
                        $(".item-title").find("span").text(msg["0"].site_notice);
                    }                    
                    $(".footer").html(unescape(msg["0"].site_copyright));                  
                }
            });
        }, noneIframe: function () {
            if (window.parent.length == 0) {
                window.location.href = "/admin/iframe.html";
            };
          
           
        }
        
    };
    exports('common', obj);
});  
